// 1.闭包的相关知识
// 2.代码组织结构
// 3.this指向的变化过程
(function(page) {

    var form = {
        ele: {
            'oForm': 'form-man',
            'oItem': 'form-item'
        },
        init: function() {
            //console.log(this);
            form.bindEvent();
        },

        bindEvent: function() {
            var container = document.getElementById(form.ele.oForm);
            var items = document.getElementsByClassName(form.ele.oItem);
            var texts = document.getElementsByClassName('form-item-text');

            form.bind('mouseenter', form.mouseenterHander, items);
            form.bind('mouseleave', form.mouseleaveHander, items);



        },
        bind: function(eventName, functionName, elements) {
            for (var i = 0; i < elements.length; i++) {
                elements[i].addEventListener(eventName, functionName, false);
            }
        },
        mouseenterHander: function(e) {
            //console.log(this);
            e.stopPropagation();
            if (e.target != null) {
                e.target.className += ' ' + 'font14';
            }
        },
        mouseleaveHander: function(e) {
            //console.log(this);
            e.stopPropagation();
            if (e.target != null) {
                e.target.className = e.target.className.replace('font14', "").trim();
            }

        },
        showErrHandler: function() {

        },
        validateHandler: function() {

        }

    }

    page.form = form;

})(window.page || (window.page = {}))
page.form.init();
